package svgedit.japangui.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

import svgedit.japangui.JapanFrame;


/** Saves the document to the same file it was most recently saved/loaded
 *  from.
 */
@SuppressWarnings("serial")
public class SaveDocumentAction extends AbstractAction {

    private JapanFrame japanFrame;

    /** Create this action for the given frame */
    public SaveDocumentAction(JapanFrame japanFrame) {
        super("\u4FDD\u5b58\uFF98\u30B9\u30C8\u3078");
        this.japanFrame = japanFrame;
    }

    public void actionPerformed(ActionEvent ae) {
        // If there's no file yet, show the save as dialog
        if (japanFrame.getDocument().getFile() == null)
            new SaveDocumentAsAction(japanFrame).actionPerformed(ae);
        else
        	japanFrame.saveFile(japanFrame.getDocument().getFile());
    }


}
